<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<form action="https://baidu.com/sugrec">
  <input id="search">
</form>
<div id="box"></div>
<script type="module">
  import jsonp from './index.js';
  document.querySelector('#search').oninput = function (){
    const result = jsonp({
      url:"http://baidu.com/sugrec",
      params : {
        prod : 'pc',
        wd : this.value
      },
      jsonp : 'cb'
    });
    result.then(value=>{
      let html = '';
      value.g?.forEach(item=>{
        html += `
          <p>${item.q}</p>
        `
      })

      document.querySelector('#box').innerHTML = html;
    })
  }
</script>
</body>
</html>